#ifndef VM_FRAME_H
#define VM_FRAME_H

#include <list.h>
#include "threads/thread.h"
#include "threads/synch.h"

/* Frame table entry structure. */
struct frame_table_entry {
    void *kpage;                  // Physical frame address.
    void *upage;                  // User virtual page address.
    struct thread *owner;         // The owning thread.
    struct list_elem elem;        // List element for the frame table.
};

/* Initializes the frame table. */
void frame_table_init(void);

/* Allocates a frame for a user page. */
void *frame_alloc(void *upage);

/* Frees a frame. */
void frame_free(void *kpage);

/* Evicts a frame and returns its physical address. */
void *frame_evict(void);

#endif /* vm/frame.h */
